home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java for 3D & VRML Worlds
/
Java for 3d and VRML Worlds.iso
/
doc
/
homepage
/
tutorials
/
lesson7
/
shareeg1
/
shareclick.java
< prev
next >
Wrap
Text File
|
1996-08-22
|
1KB
|
47 lines
import vs.*;
import vrml.*;
public class shareclick extends Script {
SFNode sharedObjNode = (SFNode)getField("sharedobj");
Transform sharedObj = (Transform)sharedObjNode.getValue();
public shareclick () {}
public void touched (ConstSFBool flag, ConstSFTime time) {
if(flag.getValue() == true)
return;
if(Vscp.amIMaster()) {
Vscp.sendApplSpecificMsgWithDist(sharedObjNode, "rpc_rotateBox",
"", Vscp.allClientsExceptMe);
actualChangeBox();
}
else {
Vscp.sendApplSpecificMsgWithDist(sharedObjNode, "rpc_touched", "",
Vscp.responderOnly);
}
}
public void rpc_touched(ConstSFString dum1, ConstSFTime dum2) {
Vscp.sendApplSpecificMsgWithDist(sharedObjNode, "rpc_rotateBox",
"", Vscp.allClientsExceptMe);
actualChangeBox();
}
public void rpc_rotateBox(ConstSFString data, ConstSFTime time) {
actualChangeBox();
}
public void actualChangeBox() {
float [] axis = {0, 1, 0, 10};
float [] center = {0, 0, 0};
sharedObj.rotateAroundLineDegree(axis, center, sharedObj.modeRelative);
}
}